﻿using GrainManage.Data.Model;
using GrainManage.Data.Model.Table;
using GrainManage.Data.Service.Util;
using System.Collections.Generic;

namespace GrainManage.Data.Service
{
    public class ColumnService : BaseService, GrainManage.Data.Service.Interfaces.IColumnService
    {
        public ColumnService(GrainManage.Data.Access.IAccess proc) : base(proc) { }

        public List<ColumnTable> Get(IPageable page, ICountable records)
        {
            var table = Proc.ExecuteQuery(ProcConst.Column_GetByExtent, page.PageIndex, page.PageSize);
            return ConvertToModel<ColumnTable>(table, records);
        }

        public string GetHeader(string columnName)
        {
            //Column_GetHeaderByColumn
            return Proc.ExecuteScalar(ProcConst.Column_GetHeaderByColumn, columnName) as string;
        }
    }
}
